package com.usian.comment.controller.v1;

import com.usian.apis.comment.CommentRepayControllerApi;
import com.usian.comment.service.CommentRepayService;
import com.usian.model.comment.dto.CommentRepayDto;
import com.usian.model.comment.dto.CommentRepayLikeDto;
import com.usian.model.comment.dto.CommentRepaySaveDto;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: CommentRepayController
 * Author:   WGG
 * Date:    2022-12-2022/12/7-9:01
 * Version: 1.0
 * Description:
 */
@RestController
@RequestMapping("/comment/api/v1/repay")
public class CommentRepayController implements CommentRepayControllerApi {

    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 加载评论回复列表
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/loadCommentRepay")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayDto dto) {
        return commentRepayService.loadCommentRepay(dto);
    }

    /**
     * 保存回复内容
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/saveCommentRepay")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepaySaveDto dto) {
        return commentRepayService.saveCommentRepay(dto);
    }

    /**
     * 点赞回复内容
     * @param dto
     * @return
     */
    @Override
    @PostMapping("/saveCommentRepayLike")
    public ResponseResult saveCommentRepayLike(@RequestBody CommentRepayLikeDto dto) {
        return commentRepayService.saveCommentRepayLike(dto);
    }
}
